<template>
    <div class="header">
        <i class="iconfont icon-qianjin-copy" v-if="iconShow==1" @click="iconClick"></i>
        <i class="red-spot" v-if="newMessage"></i>
        {{title}}
        <slot name="icon"></slot>
    </div>
</template>
<script>
export default {
  name: "header",
  props: ["title", "iconShow", "pullRight", "pullCB", "newMessage"],
  data() {
    return {};
  },
  methods: {
    iconClick() {
        let path=window.location.href.split("#")[1]; //用来获取路劲
      if (this.$route.query.history && this.$route.query.history == 1) {
         this.$router.push({ path: "/main/home" });
      } else if (this.$route.query.index && this.$route.query.fromBanner != 1) {
          this.$router.push({
            path: "/main/recommentproduct",
            query: { index: this.$route.query.index }
          });
      } else if ((path.indexOf("mydiscover") != -1 &&!this.$route.query.id&&path.indexOf("sponsorassess")==-1 )
                 ||(path.indexOf("myfavorite") != -1 &&!this.$route.query.id) 
                 ||(path.indexOf("mycomment") != -1 &&!this.$route.query.id)
                 ) 
        {
              this.$router.push({ path: "/main/mine" });
         } else {
             this.$router.go(-1);
          }
    },
    getCash() {}
  },
  created() {}
};
</script>
<style lang="scss">
@import "../scss/variable/base.scss";
.header {
  background: -webkit-linear-gradient(bottom, #2ce9e8, #7dd7ff);
  position: fixed;
  top: 0;
  z-index: 10;
  width: 100%;
  height: 1.2rem;
  // background: $primaryColor;
  color: #fff;
  text-align: center;
  font-size: 0.42rem;
  line-height: 1.2rem;
  .icon-qianjin-copy {
    position: absolute;
    left: 0.4rem;
    color: #fff;
  }
  .icon-wenhao {
    position: absolute;
    right: 0;
    margin-right: 0.4rem;
    font-size: 0.6rem;
  }
  .icon-icon_liwu_w {
    position: absolute;
    right: 0;
    margin-right: 0.4rem;
    font-size: 0.6rem;
  }
  .icon-laba-bg {
    display: block;
    position: absolute;
    top: 0.3rem;
    right: 0.1rem;
    width: 0.8rem;
    height: 0.8rem;
    // background: url($url+"/static/img/icon32/laba@2x.png") no-repeat;
    background: url("../assets/icon/laba@2x.png") no-repeat;
    background-size: 0.6rem;
  }
  .submit {
    position: absolute;
    right: 0;
    margin-right: 0.4rem;
    font-size: 0.4rem;
  }
  .red-spot {
    display: block;
    position: absolute;
    width: 0.3rem;
    height: 0.3rem;
    // background: url($url+"/static/img/icon32/dian@2x.png") no-repeat;
    background: url("../assets/icon/dian@2x.png") no-repeat;
    background-size: 0.3rem;
    top: 0.25rem;
    right: 0.15rem;
    z-index: 99;
  }
}
</style>


